<?php
/**
Exibe um formul�rio com os campos para a altera��o de um fornecedor no banco de dados.
*/

if(!isset($_SESSION))
{
   session_start();
}

if( !function_exists('__autoload') )
{
    function __autoload($class_name) {
    require_once $class_name . '.php';
    }
}

SAEO::ValidarAcesso( array( 0, 4 ) );

// Descri��es da Ajuda
$ajudaTipo = 'showhint("A qual tipo pertence o fornecedor a ser cadastrado. Op��es: Material ou Servi�o.", this, event, "270px");';
$ajudaCategoria = 'showhint("Categoria que pertence o fornecedor.", this, event, "200px");';
$ajudaNome = 'showhint("Nome do fornecedor.", this, event, "100px");';
$ajudaCNPJCPF = 'showhint("Digite o CNPJ/CPF do fornecedor sem pontos ou tra�os.", this, event, "100px");';
$ajudaTelefone = 'showhint("Telefone para contato do fornecedor. Formato: DDD+N�mero", this, event, "100px");';
$ajudaCelular = 'showhint("Celular para contato do fornecedor. Formato: DDD+N�mero", this, event, "100px");';
$ajudaEstado = 'showhint("Estado de residencia do fornecedor.", this, event, "100px");';
$ajudaCidade = 'showhint("Cidade de residencia do fornecedor.", this, event, "100px");';
$ajudaEmail = 'showhint("Email de contato do fornecedor.", this, event, "100px");';
$ajudaSite = 'showhint("Site de informa��o do fornecedor.", this, event, "100px");';
$ajudaRazaosocial = 'showhint("Raz�o social da empresa.", this, event, "100px");';
?>
<html>
	<head>
    	<title>SAEO - Alterar Fornecedor</title>
        <script type='text/javascript' src='templates/hintbox.js'></script>
        <link rel='stylesheet' type='text/css' href='templates/estilos.css'>
        <script type='text/javascript' src='templates/js.js'></script>
        <script type='text/javascript' src='templates/ajax.js'></script>
        <script type='text/javascript' src='templates/setor.js'></script>
        <script type='text/javascript' src='templates/validacoes.js'></script>
        <script type='text/javascript' src='templates/fornecedor.js'></script>
	</head>
    <body class='body'>
    	<form name='alterarFornecedor' action='ConfirmarAlteracaoFornecedor.php' method='post' id='alterarFornecedor' onsubmit='EnviarInformacoesAlteradas();'>
     	<table width='779' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
        	<tr>
            	<td colspan='2'><?php include "Topo.php"; ?></td>
            </tr>
            <tr>
                <td colspan='2'><div class='titulosTabelas' style='width:779; height:20; background:url(templates/tabela.jpg)'>ALTERAR CADASTRO DE FORNECEDOR</div></td>
            </tr>
            <tr>
                <td colspan='2'>&nbsp;</td>
            </tr>
            <tr>
                <td colspan='2'>
                	<table class='tabela' width='650' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
                    	<tr>
                        	<td>&nbsp;</td>
						</tr>
                        <tr>
                        	<td class='textoTabelas'  width='30%'>&nbsp;Tipo:</td>
                            <td><select name='tipoInformacao' id='tipoInformacao' class='inputTexto' onchange='MostrarDiv( this.value, document.getElementById("informacao")); MostrarTitulosAlterar(this.value); CarregarCategorias(this.value); EsconderDiv(document.getElementById("mostrarDadosFornecedor"));'>
                            		<option value='0'>Selecione o Tipo do Cadastro</option>
                                    <option value='1'>Material</option>
                                    <option value='2'>Servi&ccedil;o</option>
                               	</select>  <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaTipo ?>'>[?]</a>
							</td>
						</tr>
                        <tr>
                        	<td colspan='2'>&nbsp;</td>
                        </tr>
                        <tr>
                        	<td colspan='2'>
	                            <div id='informacao' style='display: none' >
	                            	<table width='650' border='0' class='tabela' style='border-style: none' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFE3'>
	                                	<tr>
	                                    	<td class='textoTabelas' style='width:40%'><span id='existente'></span></td>
	                                        <td style='width:20%'>&nbsp</td>
	                                        <td class='textoTabelas' style='width:40%;'><span id='selecionada' style='margin-left:48px;'></span></td>
	                                    </tr>
	                                    <tr>
	                                    	<td>
	                                        	<select name='listaInformacao' id='listaInformacao' style='margin-left:15px' class='inputTexto' onchange='EsconderDiv(document.getElementById("mostrarDadosFornecedor")); CarregarFornecedorPorEspecializacao();'>
	                                            	<option value=0></option>
	                                            </select>
	                                        </td>
	                                        <td>&nbsp;</td>
											<td>
	                                        	<select name='listaFornecedores' id='listaFornecedores' class='inputTexto' style='float:right;margin-right:10px' onchange='MostrarDiv( this.value, document.getElementById("mostrarDadosFornecedor")); CarregarFornecedor();'>
	                                            	<option id='opcaoFornecedor' value=0></option>
	                                            </select>&nbsp;
											</td>
	                                    </tr>
									</table>
								</div>
                            </td>
						</tr>
                        <tr>
                        	<td colspan='3'>
                            	<div id='mostrarDadosFornecedor' style='display: none'>
                                	<table width='650' border='0' class='tabela' style='border-style: none' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFE3'>
                                    	<tr>
                                        	<td class='textoTabelas'><span id='categoriaNaoSelecionada' style='margin-left:30px'></span></td>
                                        	<td>&nbsp;</td>
                                        	<td class='textoTabelas'><span id='categoriaSelecionada'></span></td>
                                    	</tr>
                                    	<tr>
                                        	<td style='width:40%'>
                                            	<select name='listaInformacao' id='listaEspecificacoes' class='inputTexto' size='10' style='margin-left:15px; width: 280px; height: 150px;'></select>
                                        	</td>
                                        	<td style='width:20%'>&nbsp;
                                                <input type='button' value='>>' onclick='AdicionarInformacao( document.alterarFornecedor.listaEspecificacoes, document.alterarFornecedor.listaEspecificacoesSelecionada );'>
												<br />
                                                <br />&nbsp;
                                                <input type='button' value='<<' onclick='RemoverInformacao( document.alterarFornecedor.listaEspecificacoesSelecionada, document.alterarFornecedor.listaEspecificacoes);'>
                                            </td>
                                            <td width:40%'>
                                                <select name='listaInformacao' id='listaEspecificacoesSelecionada' class='inputTexto' size='10' style='float:right; margin-right:10px; width: 280px; height: 150px;'></select>
                                            </td>
										</tr>
                                    	<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                    	</tr>
                                    	<tr>
                                       		<td class='textoTabelas' width='30%'>&nbsp;Nome:</td>
                                       		<td colspan='2'><input type='text' name='nomeFornecedor' id='nomeFornecedor' size='45' maxlength='150' class='inputTexto'> <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaNome ?>'>[?]</a></td>
                                    	</tr>
                                    	<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                    	</tr>
                                    	<tr>
                                       		<td class='textoTabelas'>&nbsp;CNPJ/CPF:</td>
                                       		<td colspan='2'><input type='text' name='cnpjcpfFornecedor' id='cnpjcpfFornecedor' size='14' maxlength='14' class='inputTexto' onkeypress='return blockNumbers(event)'> <SPAN class='textoPequeno'>Sem pontos ou tra�os</SPAN><a href='#' class='hintanchor' onMouseover='<?php echo $ajudaCNPJCPF ?>'>[?]</a></td>
                                   		</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>
                                   		<tr>
                                       		<td class='textoTabelas'>&nbsp;Telefone:</td>
                                       		<td colspan='2'><input type='text' name='telefoneFornecedor' id='telefoneFornecedor' size='10' maxlength='10' class='inputTexto' onkeypress='return blockNumbers(event)'> <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaTelefone ?>'>[?]</a></td>                                   		
                                       	</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>
                                   		<tr>
                                       		<td class='textoTabelas'>&nbsp;Telefone Comercial:</td>
                                       		<td colspan='2'><input type='text' name='telefoneComercial' id='telefoneComercial' size='10' maxlength='10' class='inputTexto' onkeypress='return blockNumbers(event)'> <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaTelefone ?>'>[?]</a></td>                                   		
                                       	</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>
                                   		<tr>
                                       		<td class='textoTabelas'>&nbsp;Fax:</td>
                                       		<td colspan='2'><input type='text' name='faxFornecedor' id='faxFornecedor' size='10' maxlength='10' class='inputTexto' onkeypress='return blockNumbers(event)'> <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaTelefone ?>'>[?]</a></td>                                   		
                                       	</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>                                   		                                   		                                   		
                                   		<tr>
                                       		<td class='textoTabelas'>&nbsp;Celular:</td>
                                       		<td colspan='2'><input type='text' name='celularFornecedor' id='celularFornecedor' size='10' maxlength='10' class='inputTexto' onkeypress='return blockNumbers(event)'> <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaCelular ?>'>[?]</a></td>
                                   		</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>
                                   		<tr>
                                       		<td class='textoTabelas'>&nbsp;Estado:</td>
                                       		<td colspan='2'>
                                       			<select name='estadoFornecedor' id='estadoFornecedor' class='inputTexto'>
                                           			<option value='0'>Selecione o estado do Fornecedor</option>
                                           			<option value='AC'>Acre</option>
                                           			<option value='AL'>Alagoas</option>
                                           			<option value='AP'>Amap&aacute;</option>
                                           			<option value='AM'>Amazonas</option>
                                           			<option value='BA'>Bahia</option>
                                           			<option value='CE'>Cear&aacute;</option>
                                           			<option value='DF'>Distrito Federal</option>
                                           			<option value='ES'>Esp&iacute;rito Santo</option>
                                           			<option value='GO'>Goi&aacute;s</option>
                                           			<option value='MA'>Maranh&atilde;o</option>
                                           			<option value='MT'>Mato Grosso</option>
                                           			<option value='MS'>Mato Grosso do Sul</option>
                                           			<option value='MG'>Minas Gerais</option>
                                           			<option value='PA'>Par&aacute;</option>
                                           			<option value='PB'>Para&iacute;ba</option>
                                           			<option value='PR'>Paran&iacute;</option>
                                           			<option value='PE'>Pernambuco</option>
                                           			<option value='PI'>Piau&iacute;</option>
                                           			<option value='RJ'>Rio de Janeiro</option>
                                           			<option value='RN'>Rio Grande do Norte</option>
                                           			<option value='RS'>Rio Grande do Sul</option>
                                           			<option value='RO'>Rond&ocirc;nia</option>
                                           			<option value='RR'>Roraima</option>
                                           			<option value='SC'>Santa Catarina</option>
                                           			<option value='SP'>S&atilde;o Paulo</option>
                                           			<option value='SE'>Sergipe</option>
                                           			<option value='TO'>Tocantins</option>
                                           		</select>
                                        		<a href='#' class='hintanchor' onMouseover='<?php echo $ajudaEstado ?>'>[?]</a>
                                        	</td>
                                   		</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>
                                   		<tr>
                                       		<td class='textoTabelas'>&nbsp;Cidade:</td>
                                       		<td colspan='2'><input type='text' name='cidadeFornecedor' id='cidadeFornecedor' size='45' maxlength='100' class='inputTexto'> <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaCidade ?>'>[?]</a></td>
                                   		</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>
                                   		<tr>
                                       		<td class='textoTabelas'>&nbsp;E-mail:</td>
                                       		<td colspan='2'><input type='text' name='emailFornecedor' id='emailFornecedor' size='45' maxlength='150' class='inputTexto'> <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaEmail ?>'>[?]</a></td>
                                   		</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>
                                   		<tr>
                                       		<td class='textoTabelas'>&nbsp;Site:</td>
                                       		<td colspan='2'><input type='text' name='siteFornecedor' id='siteFornecedor' size='45' maxlength='150' class='inputTexto'> <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaSite ?>'>[?]</a></td>
                                   		</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>
                                   		<tr>
                                       		<td class='textoTabelas'>&nbsp;Raz&atilde;o Social:</td>
                                       		<td colspan='2'><input type='text' name='razaoSocialFornecedor' id='razaoSocialFornecedor' size='45' maxlength='150' class='inputTexto'> <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaRazaosocial ?>'>[?]</a></td>
                                   		</tr>
                                   		<tr>
                                       		<td colspan='3'>&nbsp;</td>
                                   		</tr>
                                   		<tr>
                                       		<td colspan='2' height='46'><div style='position:relative;left:540px'><input type='image' style='width:100px;height:30px;' src='templates/btavancar.JPG'/></div></td>
                                   		<tr>
                                   	</table>
								</div>
							</td>
						</tr>
                        <tr>
                        	<td colspan='3'>&nbsp;</td>
						</tr>
					</table>
				</td>
			</tr>
            <tr>
            	<td colspan='2'>&nbsp;</td>
            </tr>
            <tfoot>
				<tr>
                	<?php include 'rodapeCreditos.php'; ?>
				</tr>
            </tfoot>
		</table>
		</form>
	</body>
</html>